#pragma once
#include <YSimpleSystem/YProactorToken.h>
#include <WinSock2.h>

namespace ysimple_system
{
	struct IStream;
}

namespace ysimple_network
{
	struct ISendCallback;
	struct YMessageBlock;
	struct ITCPSession;

	class YProactorTokenOnSend :
		public ysimple_system::YProactorToken
	{
		ISendCallback*		m_pCallback;
		WSABUF				m_wsabuf[64];
		size_t					m_availableWSACount;
		YMessageBlock*	m_pMessageBlock;
		ITCPSession*			m_pSession;
	public:
		YProactorTokenOnSend(void);
		virtual ~YProactorTokenOnSend(void);

		void				beginInit(YMessageBlock& messageBlock, ISendCallback& callback, ITCPSession& session);	
		void				endInit(bool success);
		bool				onCompleted(bool completionStatus, LONG_PTR		completionKey, DWORD			dwBytesTransfered ) override;
		WSABUF*			getWSABuf();
		DWORD			getWSABufCount();
	};

}

